<?php

    @header("Content-type:text/html;chaset=utf-8");
    @include_once("conn.php");

    $obj = array();

    $id = $_GET["id"];

    if(!$id){
        $obj["status"] = false;
        $obj["detail"] = "请输入完整的参数";
        exit(json_encode($obj));
    }

    $insert = "delete from `cart` where id = $id";

    $bool = mysqli_query($conn,$insert);

    if(!$bool){
        $obj["status"] = false;
        $obj["detail"] = "fail";
        $obj["sql"] = $insert;
        exit(json_encode($obj));
    }

    $rows = mysqli_affected_rows($conn);

    if($rows>0){
        $obj["status"] = true;
        $obj["detail"] = "删除成功";   
    }else{
        $obj["status"] = false;
        $obj["detail"] = "删除失败，数据未改变";
    }
    exit(json_encode($obj));
?>